package com.situ.spring.proxy;

import com.situ.spring.service.IStudentService;
import com.situ.spring.service.impl.StudentServiceImpl;
import org.junit.Test;

public class Client {
    public static void main(String[] args) {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi mishu = new MiShu(dongShiZhang);
        mishu.qianZi();
    }

    @Test
    public void tes1() {
        DongShiZhang dongShiZhang = new DongShiZhang();
        IQianzi proxy = (IQianzi) ProxyFactory.getProxyInstance(dongShiZhang);
        proxy.qianZi();

        IStudentService studentServiceTarget = new StudentServiceImpl();
        IStudentService studentServiceProxy = (IStudentService) ProxyFactory.getProxyInstance(studentServiceTarget);
        studentServiceProxy.selectAll();
    }

    @Test
    public void test2() {
        IStudentService studentServiceTarget = new StudentServiceImpl();
        // studentServiceTarget.selectAll();
        // studentServiceTarget.deleteById();

        IStudentService studentServiceProxy = (IStudentService) ProxyFactory.getProxyInstance(studentServiceTarget);
        studentServiceProxy.selectAll();
        studentServiceProxy.deleteById();
    }


}
